const connection = require("../app/database");

class AuthService {
  // 查询动态权限
  async checkResource(tableName, id, userId) {
    try {
      const statement = `select * from ${tableName} where id = ? and user_id = ?`;
      const [result] = await connection.execute(statement, [id, userId]);
      return result.length === 0 ? false : true;
    } catch (error) {
      console.log(error);
    }
  }

}

module.exports = new AuthService();
